<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ page import="java.io.*"%>
<%@ page import="requestInterFace.Handle.userHandle"%>
<%@ page import="xml.response.*"%>
<%@ page import="xml.root"%>
<%@ page import="util.print.printLogCat"%>
<%@ page import="org.sql.table.*"%>
<%@ page import="xml.var"%>
<%@ page import="java.util.Vector"%>
<%@ page import="java.util.Enumeration"%>
<%@ page import="requestInterFace.UserInfoInterFace.*"%>
<%@ page import="org.json.jsonNode"%>
<%@ page import="jqgrid.jqgrid"%>
<%@ include file="../../util/paramPrint.jsp" %>
<%@ page trimDirectiveWhitespaces="true" %> 
<%   

    /*********** jqgrid ******************/
		jqgrid jq=new jqgrid();
		jq.setRows(request.getParameter(jqgrid._rows));
		jq.setSord(request.getParameter(jqgrid._sord));
		jq.setSortname(request.getParameter(jqgrid._sortname));
		jq.setPage(request.getParameter(jqgrid._page));
		jq.setOper(request.getParameter(jqgrid._oper));
		jq.setSearch(request.getParameter(jqgrid._search));
		/*************************************/
		String Product_Type = request.getParameter("Product_Type");
		
		producttypeinfo1_1 user=new producttypeinfo1_1();
		user.setLimit((jq.getPageInt()-1)*jq.getRowsInt(), jq.getRowsInt());
		if(Product_Type!=null&&!Product_Type.equals("")&&!java.net.URLDecoder.decode(Product_Type,"UTF-8").equals("全部")){
		 user.addequwhile("Product_Type"," like ","%"+java.net.URLDecoder.decode(Product_Type,"UTF-8")+"%");
		}
		Vector d=user.getTableFactroy();
	
		jsonNode json=new jsonNode(2);
		 jsonNode usall=new jsonNode(1);
		 jsonNode all=new jsonNode(0,"value","全部");
		
		 usall.putNode("all", all); 
		 json.putNode("all", usall);
		for(int i=0;i<d.size();i++){
			producttypeinfo1_1 u=(producttypeinfo1_1)d.elementAt(i);
			Enumeration e=u.getTable().elements();
        jsonNode us=new jsonNode(1);
			 int y=0;
		 for(int j=0;j<u.getResultFieldNum();j++){
			String field=(String)u.getSql().getResultField().elementAt(j);
    		var v=(var)u.getTable().get(field);
    				jsonNode node;
			if(v.getName().equals("Product_Type")){
			node=new jsonNode(0,"value",v.getValue());
			}else{
			node=new jsonNode(0,v.getName(),v.getValue());
			}
			
			us.putNode(""+y, node);
			y++;
		}

		json.putNode(""+i, us);
		}
		//printLogCat.printlnWriter(root.getXmlString());
		String rep=json.getJsonText();
%>
<%=rep%>

